// class SelectGirl {
//   constructor(private girls: string[] | number[]) {} //初始化私有属性 数组
//   getGirl(index: number): string | number {
//     return this.girls[index];
//   }
// }

// 初始泛型类型

interface GirlName {
  name: string;
}

class SelectGirl<T extends GirlName> {
  constructor(private girls: T[]) {}
  getGirl(index: number): string {
    return this.girls[index].name;
  }
}

const selectGirl = new SelectGirl([
  { name: "大脚" },
  { name: "刘英" },
  { name: "晓红" },
]);
console.log(selectGirl.getGirl(1));
